package com.game.battleship.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class HighScoresAdapter extends BaseAdapter {

	private Context mContext;
	private String[] mUsernames;
	private int[] mScores;
	
	public HighScoresAdapter(Context context, String[] usernames, int[] scores) {
		this.mContext = context;
		this.mUsernames = usernames;
		this.mScores = scores;
	}
	
	public int getCount() {
		// TODO Auto-generated method stub
		return this.mUsernames.length;
	}

	public String getItem(int pos) {
		// TODO Auto-generated method stub
		return this.mUsernames[pos] + "|" + this.mScores[pos];
	}

	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	public View getView(int pos, View view, ViewGroup parent) {
		// TODO Auto-generated method stub
		TextView tv = new TextView(mContext);
		String text = getItem(pos);
		tv.setText(text);
		view = tv;
		return view;
	}

}
